﻿<Window x:Class="TestVisioCanvas.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
        xmlns:visio="clr-namespace:AxMicrosoft.Office.Interop.VisOcx;assembly=AxInterop.Microsoft.Office.Interop.VisOcx"
        xmlns:System="clr-namespace:System;assembly=mscorlib"
        xmlns:models="clr-namespace:TestVisioCanvas.Models"
        xmlns:converters="clr-namespace:TestVisioCanvas.Converters"
        Title="MainWindow" WindowState="Maximized" MouseUp="_WFHost_MouseUp"
        Icon="psm_logo_violet.png" TouchUp="Window_TouchUp" WindowStyle="None"
        UseLayoutRounding="True">    
    <Window.Resources>
        <converters:EnumNameConverter x:Key="CategoryNameConverter"/>
        <converters:MarginValueConverter x:Key="MarginValueConverter"/>
        <SolidColorBrush x:Key="PassamontiBrown" Color="#ff1f1a17"/>
        <SolidColorBrush x:Key="PassamontiVioletBlue" Color="#FF4800AE"/>                

        <ControlTemplate TargetType="{x:Type Button}" x:Key="ActionButton">
            <Border Margin="0,0,2,0" Name="BTBorder"  BorderThickness="1" BorderBrush="DarkGray" 
                Background="{StaticResource ResourceKey=PassamontiVioletBlue}">
                <TextBlock Margin="2,2,2,2" HorizontalAlignment="Center" VerticalAlignment="Center"
                    Text="{Binding RelativeSource={RelativeSource AncestorType=Button, Mode=FindAncestor}, Path=Content}"
                    FontFamily="Segoe UI" FontWeight="SemiBold" FontSize="13" Foreground="White"/>
            </Border>
            <ControlTemplate.Triggers>
                <Trigger Property="IsPressed" Value="True">
                    <Setter TargetName="BTBorder" Property="BorderThickness" Value="3"/>
                    <Setter TargetName="BTBorder" Property="BorderBrush" Value="Yellow"/>
                </Trigger>
                <Trigger Property="IsPressed" Value="false">
                    <Setter TargetName="BTBorder" Property="BorderThickness" Value="1"/>
                    <Setter TargetName="BTBorder" Property="BorderBrush" Value="Black"/>
                </Trigger>
            </ControlTemplate.Triggers>
        </ControlTemplate>

        <Style TargetType="Image">
            <Setter Property="RenderOptions.BitmapScalingMode" Value="Fant"/>
        </Style>
        <Style x:Key="CategoryLBItem" TargetType="ListBoxItem">
            <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type ListBoxItem}" >
                        <Border Margin="0,2,0,0" Name="BTBorder"  BorderThickness="0" BorderBrush="DarkGray" 
                            Background="{StaticResource ResourceKey=PassamontiVioletBlue}" >
                            <ContentPresenter/>
                        </Border>                        
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsSelected" Value="True">
                                <Setter TargetName="BTBorder" Property="Background" Value="Magenta"/>
                            </Trigger>
                            <Trigger Property="IsSelected" Value="false">
                                <Setter TargetName="BTBorder" Property="Background" Value="{StaticResource ResourceKey=PassamontiVioletBlue}"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>            
        </Style>
        <SolidColorBrush x:Key="DisabledForegroundBrush" Color="#888" />
        <!-- Region  Left Scrollbar Style Definition-->
        <Style x:Key="ScrollBarLineButton" TargetType="{x:Type RepeatButton}">
            <Setter Property="SnapsToDevicePixels" Value="True"/>
            <Setter Property="OverridesDefaultStyle" Value="true"/>
            <Setter Property="Focusable" Value="false"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type RepeatButton}">
                        <Border
          Name="Border"
          Margin="1"
          CornerRadius="2"
          Background="Transparent"
          BorderBrush="Transparent"
          BorderThickness="1">
                            <Path
            HorizontalAlignment="Center"
            VerticalAlignment="Center"
            Fill="Black"
            Data="{Binding Path=Content,RelativeSource={RelativeSource TemplatedParent}}" />
                        </Border>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsPressed" Value="true">
                                <Setter TargetName="Border" Property="Background" Value="{StaticResource PressedBrush}" />
                            </Trigger>
                            <Trigger Property="IsEnabled" Value="false">
                                <Setter Property="Foreground" Value="{StaticResource DisabledForegroundBrush}"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <Style x:Key="ScrollBarPageButton" TargetType="{x:Type RepeatButton}">
            <Setter Property="SnapsToDevicePixels" Value="True"/>
            <Setter Property="OverridesDefaultStyle" Value="true"/>
            <Setter Property="IsTabStop" Value="false"/>
            <Setter Property="Focusable" Value="false"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type RepeatButton}">
                        <Border Background="Transparent" />
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <Style x:Key="ScrollBarThumb" TargetType="{x:Type Thumb}">
            <Setter Property="SnapsToDevicePixels" Value="True"/>
            <Setter Property="OverridesDefaultStyle" Value="true"/>
            <Setter Property="IsTabStop" Value="false"/>
            <Setter Property="Focusable" Value="false"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Thumb}">
                        <Border
          CornerRadius="2"
          Background="{TemplateBinding Background}"
          BorderBrush="{TemplateBinding BorderBrush}"
          BorderThickness="1" />
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <ControlTemplate x:Key="VerticalScrollBar" TargetType="{x:Type ScrollBar}">
            <Grid>
                <Rectangle Fill="Gray" Width="8"/>
                <Track
      Name="PART_Track"
      Grid.Row="1"
      IsDirectionReversed="true"
      ViewportSize="NaN">
                    <Track.DecreaseRepeatButton>
                        <RepeatButton
          Style="{StaticResource ScrollBarPageButton}"
          Command="ScrollBar.PageUpCommand" />
                    </Track.DecreaseRepeatButton>
                    <Track.Thumb>
                        <Thumb
          Style="{StaticResource ScrollBarThumb}"
          Margin="1,0,1,0" 
          Height="20" Width="20"
          Background="Orange"
          BorderBrush="Orange" />
                    </Track.Thumb>
                    <Track.IncreaseRepeatButton>
                        <RepeatButton
          Style="{StaticResource ScrollBarPageButton}"
          Command="ScrollBar.PageDownCommand" />
                    </Track.IncreaseRepeatButton>
                </Track>
            </Grid>
        </ControlTemplate>

        <Style x:Key="{x:Type ScrollBar}" TargetType="{x:Type ScrollBar}">
            <Setter Property="SnapsToDevicePixels" Value="True"/>
            <Setter Property="OverridesDefaultStyle" Value="true"/>
            <Style.Triggers>
                <Trigger Property="Orientation" Value="Vertical">
                    <Setter Property="Width" Value="30"/>
                    <Setter Property="Height" Value="Auto" />
                    <Setter Property="Template" Value="{StaticResource VerticalScrollBar}" />
                </Trigger>
            </Style.Triggers>
        </Style>
        <!-- End Region Left Scrollbar Style Definition-->    
        
        <Style TargetType="{x:Type ListBox}" x:Key="MagentoProductsListBoxStyle">
            <Setter Property="Background" Value="LightGray" />
            <Setter Property="BorderThickness" Value="2" />
            <Setter Property="HorizontalContentAlignment" Value="Center" />
            <Setter Property="Padding" Value="5" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type ListBox}">
                        <Border Background="White" BorderBrush="Black"
                            BorderThickness="1" CornerRadius="6">
                            <ScrollViewer Margin="4">
                                <ItemsPresenter />
                            </ScrollViewer>
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <!--Height="{DynamicResource ResourceKey=ProductHeight}"
            Margin="{DynamicResource ResourceKey=PListMargin}"-->
        <DataTemplate x:Key="MagentoProductDataTemplate">
            <Grid Background="White"                
                HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                    <Image VerticalAlignment="Stretch" HorizontalAlignment="Stretch"
                                    Margin="0" Source="{Binding ImagePath}" Stretch="Uniform"
                                    RenderOptions.BitmapScalingMode="Fant"/>
                    <TextBlock Name="DeleteProductTB" VerticalAlignment="Top"
                                    HorizontalAlignment="Right"
                                    FontFamily="Arial" FontWeight="Bold" FontSize="20" Foreground="Magenta" 
                                    Text="X" MouseLeftButtonDown="DeleteProductTB_MouseLeftButtonDown"
                                    TouchUp="DeleteProductTB_TouchUp"/>
                    <TextBlock Name="ZoomProductTB" VerticalAlignment="Bottom"
                                    HorizontalAlignment="Right" 
                                    FontFamily="Arial" FontWeight="Bold" FontSize="24" Foreground="{StaticResource ResourceKey=PassamontiVioletBlue}" 
                                    Text="+" MouseLeftButtonDown="ZoomProductTB_MouseLeftButtonDown"
                                    TouchUp="ZoomProductTB_TouchUp"/>
                </Grid>
        </DataTemplate>

        <Style x:Key="MagentoProductContainerStyle" TargetType="{x:Type ListBoxItem}">
            <Setter Property="Background" Value="#FF3B0031" />
            <Setter Property="FocusVisualStyle" Value="{x:Null}" />
            <Setter Property="Height" Value="{DynamicResource ResourceKey=ProductHeight}"/>
            <Setter Property="Margin" Value="{DynamicResource ResourceKey=PListMargin}"/>
            <Setter Property="Padding" Value="0" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type ListBoxItem}">
                        <Border Name="border" BorderThickness="3" BorderBrush="Black"
                            CornerRadius="6" Opacity="1">
                            <Border BorderThickness="1" BorderBrush="Black"
                                CornerRadius="6" Opacity="1">
                                <Grid>
                                    <ContentPresenter x:Name="ContentHost" Margin="{TemplateBinding Padding}"
                                    HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                    VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
                                    <Rectangle Fill="{x:Null}" Stroke="#FFFFFFFF"
                                    RadiusX="3" RadiusY="3" Margin="1" />
                                </Grid>
                            </Border>
                        </Border>
                        <ControlTemplate.Triggers>
                            <Trigger Property="Selector.IsSelected" Value="True">
                                <Setter TargetName="border" Property="BorderBrush" Value="{StaticResource PassamontiVioletBlue}" />
                                <Setter TargetName="ContentHost" Property="BitmapEffect">
                                    <Setter.Value>
                                        <OuterGlowBitmapEffect GlowColor="White" GlowSize="9" />
                                    </Setter.Value>
                                </Setter>                                
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>


        <ObjectDataProvider x:Key="CategoryEnumDataProvider" 
                MethodName="GetValues" ObjectType="{x:Type System:Enum}">
            <ObjectDataProvider.MethodParameters>
                <x:Type TypeName="models:MasterCategory"/>
            </ObjectDataProvider.MethodParameters>
        </ObjectDataProvider>
    </Window.Resources>    
    <Grid Name="LayoutRoot" MouseUp="_WFHost_MouseUp" TouchUp="Window_TouchUp">
        <Grid.RowDefinitions>
            <!--<RowDefinition Height=".2057*"/>                        
            <RowDefinition Height="0.6533*"/>            
            <RowDefinition Height=".141*"/>-->
            <RowDefinition Height=".160*"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height=".113*"/>
            <!--<RowDefinition Height="0.0133*"/>
            <RowDefinition Height="0.1111*"/>
            <RowDefinition Height="0.0166*"/>-->
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="0.0541666*"/>            
            <ColumnDefinition Width="0.1027777*"/>
            <ColumnDefinition Width="0.0291666*"/>
            <ColumnDefinition Width="0.5354166*"/>
            <ColumnDefinition Width="0.0291666*"/>
            <ColumnDefinition Width="0.1875*"/>
            <ColumnDefinition Width="0.0618055*"/>
        </Grid.ColumnDefinitions>
        
        <!-- Grid Intestazione -->
        <Grid Grid.Row="0" Grid.Column="1" Grid.ColumnSpan="5" Background="White">
            <Grid.RowDefinitions>
                <RowDefinition Height=".1725814*"/>
                <RowDefinition Height=".7126884*"/>
                <RowDefinition Height=".1147302*"/>                
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width=".21*"/>
                <ColumnDefinition Width=".06*"/>
            </Grid.ColumnDefinitions>
            <Rectangle Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="3" Fill="{StaticResource ResourceKey=PassamontiBrown}"/>
            <Image Name="Img_Logo" Grid.Row="1" Grid.Column="1" Source="/Images/Logo.png" 
                VerticalAlignment="Bottom" HorizontalAlignment="Left" Margin="0,0,12,-6"/>
        </Grid>
                
        <Frame x:Name="_frame" Grid.Row="1" Grid.Column="3" NavigationUIVisibility="Hidden"/>
        <!--Host for VisioDrawingControls -->
        <WindowsFormsHost Grid.Row="1" Grid.Column="3" Name="_WFHost" AllowDrop="True">
            <visio:AxDrawingControl x:Name="_drawingControl" 
                ShapeAdded="_drawingControl_ShapeAdded"
                QueryCancelPageDelete="_drawingControl_QueryCancelPageDelete"
                PageAdded="_drawingControl_PageAdded" PageChanged="_drawingControl_PageChanged" 
                MouseUpEvent="_drawingControl_MouseUpEvent"                        
                BeforeSelectionDelete="_drawingControl_BeforeSelectionDelete"/>            
        </WindowsFormsHost>
        <!--Menu Arredi PreEsistenti-->
        <Grid Grid.Column="1" Grid.Row="1">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>               
                <RowDefinition Height="0.75*"/>                
            </Grid.RowDefinitions>  
            <!--Categories Listbox-->
            <ListBox Grid.Row="0"
                ItemContainerStyle="{StaticResource CategoryLBItem}"
                ItemsSource="{Binding Source={StaticResource ResourceKey=CategoryEnumDataProvider}}"
                ScrollViewer.HorizontalScrollBarVisibility="Disabled"
                SelectionChanged="ListBox_SelectionChanged">
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <TextBlock Margin="4,0,0,0" FontFamily="Segoe UI" FontWeight="SemiBold" FontSize="12" Foreground="White"
                        Text="{Binding Converter={StaticResource ResourceKey=CategoryNameConverter}}" />                        
                    </DataTemplate>
                </ListBox.ItemTemplate>                
            </ListBox>
            <!--Masters Listbox-->
            <ListBox x:Name="_MasterLB" Grid.Row="1"
                 ScrollViewer.ScrollChanged="_MasterLB_ScrollChanged"                 
                 ScrollViewer.HorizontalScrollBarVisibility="Disabled"
                 ScrollViewer.VerticalScrollBarVisibility="Visible" VerticalContentAlignment="Top"
                 PreviewMouseLeftButtonDown="_MasterLB_PreviewMouseLeftButtonDown"
                 PreviewTouchDown="_MasterLB_PreviewTouchDown"
                 ItemsSource="{Binding MastersQuery}">
                <ListBox.ItemsPanel>
                    <ItemsPanelTemplate>
                        <UniformGrid Columns="2" VerticalAlignment="Top"/>                        
                    </ItemsPanelTemplate>
                </ListBox.ItemsPanel>
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <StackPanel Margin="2" MaxHeight="96" >
                            <Image Source="{Binding Image}" MaxHeight="52" HorizontalAlignment="Center"
                                VerticalAlignment="Center"/>
                            <TextBlock Margin="1" HorizontalAlignment="Center"
                                Text="{Binding DisplayName}" FontFamily="Segoe UI" FontSize="11"
                                TextWrapping="Wrap"/>                        
                        </StackPanel>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>                        
        </Grid>        
        <!--Menu prodotti-->
        <Grid Grid.Column="5" Grid.Row="1">            
            <ListBox x:Name="_productsLB"
                 ItemsSource="{Binding ProductQuery}" 
                 ScrollViewer.HorizontalScrollBarVisibility="Disabled"
                 ScrollViewer.VerticalScrollBarVisibility="Hidden"
                 VerticalAlignment="Stretch" VerticalContentAlignment="Stretch" 
                 PreviewMouseLeftButtonDown="_productsLB_PreviewMouseLeftButtonDown"
                 PreviewTouchDown="_productsLB_PreviewTouchDown"
                 MouseRightButtonUp="_productsLB_MouseRightButtonUp"                  
                 MouseDoubleClick="_productsLB_MouseRightButtonUp" Padding="0"                     
                 HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch"                  
                 BorderThickness="0" Margin="{DynamicResource ResourceKey=NListMargin}" Background="Transparent"
                ItemTemplate="{StaticResource MagentoProductDataTemplate}"
                ItemContainerStyle="{StaticResource MagentoProductContainerStyle}">
                <ListBox.ItemsPanel>
                    <ItemsPanelTemplate>
                        <UniformGrid Margin="0" Columns="{Binding Columns}" Rows="{Binding Rows}" IsItemsHost="True"
                        VerticalAlignment="Stretch" HorizontalAlignment="Stretch"/>                                                   
                    </ItemsPanelTemplate>
                </ListBox.ItemsPanel>
                <!--<ListBox.ItemContainerStyle>
                    <Style TargetType="ListBoxItem">
                        <Setter Property="Padding" Value="0"/>
                    </Style>
                </ListBox.ItemContainerStyle>-->                
            </ListBox>
            <!--<ListBox x:Name="_productsLB"
                 ItemsSource="{Binding ProductQuery}" 
                 Style="{StaticResource MagentoProductsListBoxStyle}"
                 ItemTemplate="{StaticResource MagentoProductDataTemplate}"
                 ItemContainerStyle="{StaticResource MagentoProductContainerStyle}"
                 Margin="{DynamicResource ResourceKey=NListMargin}">
                <ListBox.ItemsPanel>
                    <ItemsPanelTemplate>
                        <UniformGrid Margin="0" Columns="{Binding Columns}" Rows="{Binding Rows}" IsItemsHost="True"
                        VerticalAlignment="Stretch" HorizontalAlignment="Stretch"/>
                    </ItemsPanelTemplate>
                </ListBox.ItemsPanel>
            </ListBox>-->
        </Grid>                
        <!--Action Menu-->
        <Grid Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="5">
            <Grid.RowDefinitions>
                <RowDefinition Height=".094*"/>
                <RowDefinition Height=".788*"/>
                <RowDefinition Height=".118*"/>            
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width=".116260801*"/>
                <ColumnDefinition Width=".032999293*"/>
                <ColumnDefinition Width=".605655593*"/>
                <ColumnDefinition Width=".032999293*"/>
                <ColumnDefinition Width=".212097407*"/>
            </Grid.ColumnDefinitions>
            <Rectangle Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="5" Fill="{StaticResource ResourceKey=PassamontiBrown}"/>
            
            <!-- Action Buttons-->
            <Grid Grid.Column="2" Grid.Row="1">                
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="0.75*"/>
                    <ColumnDefinition Width="Auto"/>                    
                </Grid.ColumnDefinitions>
                <Button Name="PrintBT" Click="Print_Click" TouchUp="PrintBT_TouchUp"
                        HorizontalAlignment="Left" Grid.Column="0"
                        Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}"
                        Width="{Binding Rect_BT}" VerticalAlignment="Center">
                    <Image Source="/Images/NewIconsL/stampa.png" Stretch="Uniform"/>
                </Button>
                <DockPanel HorizontalAlignment="Center" VerticalAlignment="Top" Grid.Column="1"
                    Width="{Binding RelativeSource={RelativeSource AncestorType=ColumnDefinition,Mode=FindAncestor},Path=ActualWidth}">                                    
                    <DockPanel.Resources>
                        <Style BasedOn="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" TargetType="Button">
                            <Setter Property="VerticalAlignment" Value="Center"/>
                            <Setter Property="Margin" Value="6,8,0,0"/>
                        </Style>
                    </DockPanel.Resources>
                    <Button Name="DuplicateBT" Click="DuplicateBT_Click" TouchUp="DuplicateBT_TouchUp" Width="{Binding DuplicateBTWidth}">
                        <Image Source="/Images/NewIconsL/duplicaL.png" Stretch="Uniform"/>
                    </Button>
                    <Button Name="FlipHorBT" Click="Flip_Click" TouchUp="Flip_TouchUp" Width="{Binding FlipHorBT_np_scroll}">
                        <Image Source="/Images/NewIconsL/specchia1.png" Stretch="Uniform"/>
                    </Button>
                    <Button Name="FlipVertBT" Click="Flip_Click" TouchUp="Flip_TouchUp" Width="{Binding FlipVertBT}">
                        <Image Source="/Images/NewIconsL/specchia2.png" Stretch="Uniform"/>
                    </Button>
                    <Button Name="AlignVert" Click="Align_Click" TouchUp="Align_TouchUp" Width="{Binding AlignHorBT}">
                        <Image Source="/Images/NewIconsL/allinea1.png" Stretch="Uniform"/>
                    </Button>
                    <Button Name="AlignHor" Click="Align_Click" TouchUp="Align_TouchUp" Width="{Binding AlignVertBT}">
                        <Image Source="/Images/NewIconsL/allinea2.png" Stretch="Uniform"/>
                    </Button>
                    <Button Name="RotateBT" Click="RotateBT_Click" TouchUp="RotateBT_TouchUp" Width="{Binding CircularBT}">
                        <Image Source="/Images/NewIconsL/ruota.png" Stretch="Uniform"/>
                    </Button>
                    <Button Name="ZoomInBT" Click="Zoom_Click" TouchUp="Zoom_TouchUp" Width="{Binding CircularBT}">
                        <Image Source="/Images/NewIconsL/zoom_piu.png" Stretch="Uniform"/>
                    </Button>
                    <Button Name="ZoomOutBT" Click="Zoom_Click" TouchUp="Zoom_TouchUp" Width="{Binding CircularBT}">
                        <Image Source="/Images/NewIconsL/zoom_meno.png" Stretch="Uniform"/>
                    </Button>
                    <Button Name="ZoomFitBT" Click="Zoom_Click" TouchUp="Zoom_TouchUp" Width="{Binding CircularBT}">
                        <Image Source="/Images/NewIconsL/zoom_selezione.png" Stretch="Uniform"/>
                    </Button>
                    <Button Name="NewPageBT" Click="NewPageBT_Click" TouchUp="NewPageBT_TouchUp" Width="{Binding FlipHorBT_np_scroll}">
                        <Image Source="/Images/NewIconsL/new_page.png" Stretch="Uniform"/>
                    </Button>
                    <Button Name="DeleteBT" Click="DeleteBT_Click" TouchUp="DeleteBT_TouchUp" Width="{Binding CircularBT}">
                        <Image Source="/Images/NewIcons/canc.png" Stretch="Uniform"/>
                    </Button>                    
                </DockPanel>
                <Button Name="ExcelBT" Click="ExcelBT_Click" TouchUp="ExcelBT_TouchUp"
                    HorizontalAlignment="Right" Grid.Column="2"
                    Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}"
                    Width="{Binding Rect_BT}"  VerticalAlignment="Center">
                    <Image Source="/Images/NewIconsL/preventivo.png" Stretch="Uniform"/>
                </Button>
            </Grid>
        </Grid>
        <!-- Product scroll buttons-->        
        <Grid Grid.Row="2" Grid.Column="5">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width=".537*"/>
                <ColumnDefinition Width=".463*"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height=".1*"/>
                <RowDefinition Height=".78*"/>
                <RowDefinition Height=".12*"/>
            </Grid.RowDefinitions>
            <Button Grid.Column="0" Grid.Row="1"               
                HorizontalAlignment="Left" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}"
                Width="{Binding FlipHorBT_np_scroll}"
                Name="scorriSX"  VerticalAlignment="Bottom"
                Click="scorriSX_Click" TouchUp="scorriSX_TouchUp">
                <Image Source="/Images/NewIconsL/freccia_sx.png" Stretch="Uniform"/>                
            </Button>
            <Button Grid.Column="1" Grid.Row="1"
                Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}"
                Width="{Binding FlipHorBT_np_scroll}"                    
                VerticalAlignment="Top" HorizontalAlignment="Left"                
                Click="scorri_Click" TouchUp="Scorri_TouchUp">
                <Image Source="/Images/NewIconsL/freccia_dx.png" Stretch="Uniform"/>
            </Button>
        </Grid>
        <!-- Arredi Scroll buttons-->
        <Grid Grid.Row="2" Grid.Column="1">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width=".136*"/>
                <ColumnDefinition Width=".864*"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height=".1*"/>
                <RowDefinition Height=".78*"/>
                <RowDefinition Height=".12*"/>
            </Grid.RowDefinitions>            
            <Button Grid.Column="1" Grid.Row="1"
                Name="ScrollDownButton" 
                Click="ScrollDownButton_Click" TouchUp="ScrollDownButton_TouchUp"
                VerticalAlignment="Bottom" HorizontalAlignment="Right"
                Height="{Binding FlipHorBT_np_scroll}"
                Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}">
                <Image Source="/Images/NewIconsL/freccia_down.png" Stretch="Uniform"/>
            </Button>
            <Button Grid.Column="1" Grid.Row="1"
                Name="ScrollUpButton" Height="{Binding FlipHorBT_np_scroll}"
                Click="ScrollUpButton_Click" TouchUp="ScrollUpButton_TouchUp"
                HorizontalAlignment="Left" VerticalAlignment="Top"                
                Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}">
                <Image Source="/Images/NewIconsL/freccia_up.png"/>
            </Button>
        </Grid>

        <!-- Proxy for zoom management-->
        <Slider Visibility="Collapsed" Grid.Column="2" Grid.Row="2" VerticalAlignment="Bottom" Height="23" HorizontalAlignment="Right"
            Name="_zoomSilder" Width="100" Minimum="0.25" Maximum="4"
            ValueChanged="_zoomSilder_ValueChanged"/>
    </Grid>
</Window>
